home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / text / edit / vim60src.lha / Vim / vim60 / src / testdir / test45.in < prev    next >
Encoding:
Text File  |  2001-09-08  |  1.4 KB  |  67 lines

  1. Tests for folding. vim: set ft=vim :
  2.  
  3. STARTTEST
  4. :so small.vim
  5. :" basic test if a fold can be created, opened, moving to the end and closed
  6. /^1
  7. zf2j:call append("$", "manual " . getline(foldclosed(".")))
  8. zo:call append("$", foldclosed("."))
  9. ]z:call append("$", getline("."))
  10. zc:call append("$", getline(foldclosed(".")))
  11. :" test folding with markers.
  12. :set fdm=marker fdl=1 fdc=3
  13. /^5
  14. :call append("$", "marker " . foldlevel("."))
  15. [z:call append("$", foldlevel("."))
  16. jo{{ r{jj:call append("$", foldlevel("."))
  17. kYpj:call append("$", foldlevel("."))
  18. :" test folding with indent
  19. :set fdm=indent sw=2
  20. /^2 b
  21. i  jI    :call append("$", "indent " . foldlevel("."))
  22. k:call append("$", foldlevel("."))
  23. :" test syntax folding
  24. :set fdm=syntax fdl=0
  25. :syn region Hup start="dd" end="hh" fold
  26. Gzk:call append("$", "folding " . getline("."))
  27. k:call append("$", getline("."))
  28. :" test expression folding
  29. :fun Flvl()
  30.   let l = getline(v:lnum)
  31.   if l =~ "bb$"
  32.     return 2
  33.   elseif l =~ "gg$"
  34.     return "s1"
  35.   elseif l =~ "ii$"
  36.     return ">2"
  37.   elseif l =~ "kk$"
  38.     return "0"
  39.   endif
  40.   return "="
  41. endfun
  42. :set fdm=expr fde=Flvl()
  43. /bb$
  44. :call append("$", "expr " . foldlevel("."))
  45. /hh$
  46. :call append("$", foldlevel("."))
  47. /ii$
  48. :call append("$", foldlevel("."))
  49. /kk$
  50. :call append("$", foldlevel("."))
  51. :/^last/+1,$w! test.out
  52. :qa!
  53. ENDTEST
  54.  
  55. 1 aa
  56. 2 bb
  57. 3 cc
  58. 4 dd {{{
  59. 5 ee {{{ }}}
  60. 6 ff }}}
  61. 7 gg
  62. 8 hh
  63. 9 ii
  64. a jj
  65. b kk
  66. last
  67.